Until
Repeat ... Until <.expression.>
 
Parameters: NONE
Returns: NONE
 

      A Repeat-Until loop executes its sequence of constituent statements continually, testing an expression at each Until statement. When the expression returns True, the Repeat-Until loop terminates.

      The code inside a repeat until loop is always executed at least once, since the Comparisons expression is only evaluated when execution reaches the closing statement. Giving them the opposite functionality of While-EndWhile loop blocks.




FACTS:


      * Repeat-Until must be paired.

      * The Repeat must preceed the Until statement. You'll get a syntax error otherwise.

      * You can exit a Repeat-Until loop anytime with the Exit or ExitRepeat statements.

      * Do-Loop Statements can also create Repeat-Until styled loops by placing the 'Until' Comparisons expression after the Loop statement.



Mini Tutorial:


      A simple Repeat-Until loop

  
  Repeat
   ; Draw a dot at a random position
     Dot Rnd(100)+100Rnd(100)+100
   ; display the screen
     Sync
     
   ; this loop will be repeated until
   ; the user presses the Space Key
  Until SpaceKey()
  
  Print "You pressed the Space Key"
  
  WaitNoKey
  Sync
  WaitKey
  



 
Related Info: Comparisons | Continue | Exit | ExitRepeat | Repeat | While :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com